#include <iostream>
#include <string>
using namespace std;

class Solution
{
public:
    int removeElement(int A[], int n, int elem)
    {
        int i=0,j=n;
        while(i!=j)
            {
                if(A[i]==elem)
                    {
                        j=j-1;
                        int temp=A[i];
                        A[i]=A[j];
                        A[j]=temp;
                    }
                else
                    i++;
            }
        return i;
    }
};

int main()
{
    Solution s;
    int arr[]= {2,3,4,5,2,6,5,7,9,11};
    int len=sizeof(arr)/sizeof(int);
    int elem;
    while(true)
        {
            cin>>elem;
            if(elem==-1)
                break;
            cout<<s.removeElement(arr,len,elem)<<endl;
        }
}